package com.xxxx.controller;



import com.xxxx.dao.personmanagemenMapper;
import com.xxxx.model.Department;
import com.xxxx.model.personmanagement;
import com.xxxx.service.PersonmanagementService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;


@Controller
public class PersonmanagementController {
    @Autowired
    @Qualifier("personmanagementServiceImp")
    private PersonmanagementService personmanagementService;
    @RequestMapping("/queryperson")
    private String queryperson(String partname, Model model){
        List<personmanagement> list =personmanagementService.queryperson(partname);
        System.out.println(list);
        model.addAttribute("list",list);
        return "person";
    }
    @RequestMapping("/toAddperson")
    private String toAddperson(){
        return "addperson";
    }
    @RequestMapping("/Addperson")
    private String Addperson(personmanagement personmanagement,Model model){
        System.out.println(personmanagement);
        personmanagementService.addperson(personmanagement);
        return "redirect:/queryallperson";
    }
    @RequestMapping("/queryallperson")
    private String queryallperson(Model model){
        List<personmanagement> list =personmanagementService.queryAllperson();
        System.out.println(list);
        model.addAttribute("list",list);
        return "person";
    }
}

